package com.ruoyi.business.domain;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.ruoyi.business.param.VisitorCountXmlParam;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.Date;

/**
 * 访客记录对象 visitor_records
 * 
 * @author qiancheng
 * @date 2025-06-13
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
@TableName("visitor_records")
public class VisitorRecords extends BaseEntity
{
    private static final long serialVersionUID = 1L;

    /** 记录ID */
    @TableId(value = "id", type = IdType.ASSIGN_ID)
    @JsonSerialize(using = ToStringSerializer.class)
    private Long id;

    /** 访问单位 */
    @Excel(name = "访问单位")
    @TableField(value = "visit_unit")
    private String visitUnit;

    /** 访问人数（1-200合理范围） */
    @Excel(name = "访问人数", readConverterExp = "1=-200合理范围")
    @TableField(value = "visit_count")
    private Integer visitCount;

    /** 访问时间 */
    @JsonFormat(pattern = "yyyy-MM-dd")
    @Excel(name = "访问时间", width = 30, dateFormat = "yyyy-MM-dd")
    @TableField(value = "visit_time")
    private Date visitTime;

    /** 所属年份 */
    @TableField(exist = false)
    private Integer belongYear;

    /** 所属月份 */
    @TableField(exist = false)
    private Integer belongMonth;

    public VisitorRecords(VisitorCountXmlParam vCountXmlParam) {
        this.belongMonth = vCountXmlParam.getBelongMonth();
        this.belongYear = vCountXmlParam.getBelongYear();
    }

}
